﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WordTemplate.aspx.cs" Inherits="Xiaov.SmartWeb.Application.ZNPT.WordTemplate" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>模版管理</title>
    <link rel="stylesheet" type="text/css" href="/Resources/easyui-1.32/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="/Resources/easyui-1.32/themes/icon.css" />
    <link href="/Resources/easyui-1.32/demo/demo.css" rel="stylesheet" type="text/css" />
    <script src="/Resources/easyui-1.32/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/Resources/easyui-1.32/jquery.easyui.min.js"></script>
    <script src="/Resources/easyui-1.32/locale/easyui-lang-zh_CN.js" type="text/javascript"
        charset="utf-8"></script>
    <script src="/Resources/xiaovcn/scripts/common.js" type="text/javascript"></script>
    <script type="text/javascript">
        function callback(res) {
            if (res == "1") {
                $.messager.alert('提示', '操作成功！');
                rebindgrid();
            }
            else {
                $.messager.alert("error");
            }
        }


        function del(BM) {

            $.ajax({
                type: "post",
                url: "WordTemplateData.aspx?type=del",
                //                dataType: "xml",
                data: { DOCBM: BM },
                success: function (data) {
                    callback(data);
                    //                    if (data == 0) {
                    //                        alert('此登录名已存在！');
                    //                    }
                    //                    else
                    //                    { Xiaov.SmartWeb.Application.SysAdmin.Admin_User_CL.SaveUser(a, b, c, d, e, f, g, roles, dept, callback); }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(errorThrown);
                }
            });
       //     Xiao
//            Xiaov.SmartWeb.Application.SysAdmin.Admin_User_CL.DeleteUser(user.USERID, callback);
        }

        function rebindgrid() {
                //                alert(node.DWBM);
                //                $('#dg').datagrid('reload');
                $('#dg').datagrid('load', {
                    type: 'load'
                });
        
        }

       

        function bindgrid() {
            //                        alert(dept);
            var dept;
            //var node = $('#tt').treegrid('getSelected');
            //if (node != null) { dept = node.USERDEPT; }
            $('#dg').datagrid({
                title: '模版管理',
                url: 'WordTemplateData.aspx?type=load',
                iconCls: 'icon-application',
                width: 600,
                height: 500,
                nowrap: true,
                rownumbers: true,
                animate: false,
                collapsible: false,
                singleSelect: true,
                remoteSort: false,
       
                columns: [[
                             { field: 'DOCBM', title: '编码', width: 100, sortable: true, formatter: function (val, rec) { return unescape(val) } },
                             { field: 'DOCMC', title: '模版名称', sortable: true, width: 100, formatter: function (val, rec) { return unescape(val) } },
                             { field: 'DOTMC', title: '模版文件', sortable: true, width: 100, formatter: function (val, rec) { return unescape(val) } },
                //                             { field: 'PASSWORD', title: '密码', width: 100, formatter: function (val, rec) { return unescape(val) } },
                             {field: 'DOCZQ', title: '模版类型', sortable: true, width: 40, formatter: function (val, rec) { return unescape(val) } },


                    ]],
                toolbar: [{
                    text: '增加模版',
                    iconCls: 'icon-add',
                    handler: function () {
                        //增加用户
                
                        var strwindow = "toolbar=0,location=0,directories=0,status=0,scrollbars=yes,resizable=0,width=450,height=150,top=150,left=240";
                        window.open("iframe.aspx","",strwindow);

                    }
                }, '-', {
                    text: '删除模版',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        //删除用户
                        var template = $('#dg').datagrid('getSelected');
                        if (template) {
                            $.messager.confirm('提示', '确定要删除【' + unescape(template.DOCBM) + '】这个模版吗?', function (r) {
                                if (r) {
                                    del(template.DOCBM);
                                }
                            });
                        }
                    }
                }]
            });
        }


    </script>
    <script type="text/javascript">
        $(function () {
            bindgrid();
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table>
        <tr>
            <td>
                <table id="tt" style="height: 500px;">
                </table>
            </td>
            <td>
                <table id="dg">
                </table>
            </td>
        </tr>
    </table>
  
    </form>
</body>
</html>
